import { createStore } from "redux";

// const initialState = {city: '武汉'};
function reducer(initState = { city: '武汉' }, action) {
//   console.log("action", action);
  switch (action.type) {
    case 'changeCity':
        // console.log('改变了城市');
      return {
        city: action.payload,
      };

    case 'setUser':
      window.localStorage.setItem('username', action.payload)
      return {
        username: action.payload,
      };

    default:
      return initState;

      break;
  }
}

let store = createStore(reducer);

export default store;